﻿using UnityEngine;
using System.Collections;

namespace StarForce
{
    public class GameCamera : MonoBehaviour
    {

        float devHeight = 11.36f;
        float devWidth = 6.4f;

        // Use this for initialization
        void Start()
        {
            float screenHeight = Screen.height;

            Debug.Log("screenHeight = " + screenHeight);

            float orthographicSize = this.GetComponent<Camera>().orthographicSize;

            float aspectRatio = Screen.width * 1.0f / Screen.height;

            float cameraWidth = orthographicSize * 2 * aspectRatio;

            Debug.Log("cameraWidth = " + cameraWidth);

            if (cameraWidth < devWidth)
            {
                orthographicSize = devWidth / (2 * aspectRatio);
                Debug.Log("new orthographicSize = " + orthographicSize);
                this.GetComponent<Camera>().orthographicSize = orthographicSize;
            }

        }
    }
}